<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class Qrcodes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qrcodes', function (Blueprint $table) {
             $table->engine = 'InnoDB';
             $table->charset = 'utf8mb4';
             $table->collation = 'utf8mb4_unicode_ci';
            // CONTENT
            $table->increments('id')->nullable(false)->comment('');
			$table->unsignedInteger('user_id')->nullable(false)->default(0)->comment('用户编号');
			$table->char('qruuid', 32)->nullable()->default(null)->comment('二维码标识');
			$table->string('user_token', 500)->nullable()->default(null)->comment('用户token');
			$table->boolean('status')->nullable(false)->default(0)->comment('二维码状态, 0=未扫码， 1=已登录, 2=已过期');
			$table->timestamp('created_at')->nullable()->comment('');
			$table->timestamp('updated_at')->nullable()->comment('');
			$table->integer('expire_at')->nullable()->default(null)->comment('过期时间');
			
        });

        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qrcodes');
    }
}
